﻿using System;
using Uniloader.Managers;
using Uniloader.Interface;
using Uniloader.Configuration;
using XamlTorrent.Managers.UriGetter.UI;
using System.IO;

namespace XamlTorrent.Managers.UriGetter
{
    public class UriTransferManager : TransferManager, ITaskUIFactory
    {
        public UriTransferManager(TransferManagerSection config)
            : base(config)
        {
        }

        public override void Initialize()
        {
        }

        protected override int LoadSuspendedTasks()
        {
            // TODO: Add serizlization of UriTransferManager tasks
            return 0;
        }

        public override void Dispose()
        {
            foreach (UriDownloadTask task in this)
            {
                task.Suspend();
            }
        }

        #region ITaskUIFactory Members

        public TaskUI[] CreateNewTaskUI()
        {
            return new TaskUI[]{
                new TaskUI("URL", new CreateUriTask(this))
            };
        }

        public TaskUI CreateTaskPropertiesUI()
        {
            return new TaskUI("URL", new UriTaskProperties(this));
        }

        #endregion

        protected override void PersistTaskMetadata()
        {
            throw new NotImplementedException();
        }
    }
}
